package com.tedu.controller;

import com.tedu.entry.dto.EmpDTO;
import com.tedu.service.EmpService;
import com.tedu.service.impl.EmpServiceImpl;

import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;

/**
 * Author：毕龙
 * Date: 2023/7/29 10:49
 */
@WebServlet("/emp/detail")
public class EmpDetailController extends HttpServlet {
    @Override
    protected void service(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {

        //创建service对象
        String id = request.getParameter("id");
        EmpService service = new EmpServiceImpl();
        EmpDTO emp = service.selectEmpById(id);

        request.setAttribute("emp",emp);
        //请求转发
        request.getRequestDispatcher("/ems/emp/updateEmp.jsp").forward(request,response);


    }
}
